<!DOCTYPE html>
<html lang='zh-CN'>
<head>
    <meta charset="utf-8">
    <meta name="referrer" content="no-referrer" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>商品编辑</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/materialdesignicons.min.css" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.min.css" rel="stylesheet">
    <link href="js/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <!--    dropzone-->
    <link rel="stylesheet" href="js/dropzone/min/basic.min.css" />
    <link rel="stylesheet" href="js/dropzone/min/dropzone.min.css" />
    <!--    分类插件-->
    <link href="css/sort.css" rel="stylesheet">
    <!--		连续5个上传图片-->
    <link rel="stylesheet" href="js/goodUploadImg/upload.css">
    <link rel="stylesheet" href="js/goodUploadImg/uploadImg.css">
</head>
<body>
<!--                    //详细-->
<div class="container-fluid p-t-15">
    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <div class="card-body">
                    <form class="form-horizontal" onsubmit="return false;">
                        <div class="form-group" id="goodTypeDiv" style="display: none;">
                            <div class="contains">
                                <!--商品分类-->
                                <div class="wareSort clearfix">
                                    <ul id="sort1" style="height: 250px;overflow: scroll;overflow-x:hidden"></ul>
                                    <ul id="sort2" style="display: none;height: 250px;overflow: scroll;overflow-x:hidden"></ul>
                                    <ul id="sort3" style="display: none;height: 250px;overflow: scroll;overflow-x:hidden"></ul>
                                </div>
                                <div class="selectedSort">
                                    <!--                                    <input  type="hidden"  id="productTypeName" >-->
                                    <b>您当前选择的商品类别是：</b>
                                    <i id="selectedSort"></i>
                                </div>
                            </div>

                        </div>
                        <!-- 商品id -->
                        <div class="form-group">
                            <label class="col-xs-3 control-label font-0" for="productId">商品Id</label>
                            <div class="col-xs-8">
                                <p class="form-control" id="productId" name="productId"></p>
                            </div>
                        </div>
                        <!-- 商品分类 -->
                        <div class="form-group">
                            <label class="col-xs-3 control-label font-0" for="productTypeName">商品分类</label>
                            <div class="col-xs-8">
                                <input class="form-control" id="productTypeName" name="productTypeName" readonly/>
                                <button id="changeProType">切换类目</button>
                            </div>
                        </div>
                        <!-- 商品标题 -->
                        <div class="form-group">
                            <label class="col-xs-3 control-label font-0" for="productName">商品标题</label>
                            <div class="col-xs-8">
                                <input class="form-control" type="text" id="productName" name="productName"
                                       placeholder="请输入您的商品标题">
                                <div class="help-block">商品标题名称长度至少3个字符，最长50个汉字。根据消费者习惯，建议标题的设置尽可能全面概括。</div>
                            </div>
                        </div>

                        <!-- 商品规格 -->
                        <div class="form-group">
                            <label class="col-xs-3 control-label font-0" for="goods_name">商品规格</label>
                            <div class="col-xs-8">
                                <!--										规格一-->
                                <div>
                                    <div class="row bg">
                                        <div class="col-xs-9">
                                            <select class="form-control gg-select select-1" id="select-1" name="sku_one_name"
                                                    size="1">
                                            </select>
                                        </div>
                                    </div>

                                    <div class="row bg-fb div-g-1">
                                        <!--                                                            <div class="col-xs-4 m-tb">
                                                                                                        <div class="input-group">
                                                                                                            <input type="text" class="form-control i-gg i-gg-1" flag="1"/>
                                                                                                        </div>
                                                                                                    </div>-->
                                    </div>
                                    <button class="btn btn-label btn-default m-tb attr-b select-1" type="1">
                                        <label><i class="mdi mdi-loupe"></i></label>添加属性
                                    </button>
                                </div>
                                <!--										规格一结束-->

                                <div>
                                    <div class="row bg">
                                        <div class="col-xs-9">
                                            <select class="form-control gg-select select-2" id="select-2" name="sku_two_name"
                                                    size="1">
                                            </select>
                                        </div>

                                    </div>

                                    <div class="row bg-fb div-g-2">

                                        <!--                                                            <div class="col-xs-4 m-tb">
                                                                                                        <div class="input-group">
                                                                                                            <input type="text" class="form-control i-gg i-gg-2" flag="2"/>
                                                                                                        </div>
                                                                                                    </div>-->

                                    </div>
                                    <button class="btn btn-label btn-default m-tb attr-b select-2" type="2">
                                        <label><i class="mdi mdi-loupe"></i></label>添加属性
                                    </button>
                                </div>
                                <!--规格二-->
                            </div>
                        </div>
                        <!-- 价格及库存 -->
                        <div class="form-group">
                            <label class="col-xs-3 control-label font-0">价格及库存</label>
                            <div class="col-xs-8 bg-fb">
                                <div class="row div_hide" style="display: none">
                                    <div class="help-block col-xs-9">
                                        批量设置<span class="text-two">在下方栏中选择内容进行批量填充</span>
                                    </div>
                                    <div class="col-xs-3">
                                        <button class="btn btn-info fr" id="set_bun">立即设置</button>
                                    </div>
                                </div>
                                <div class="row div_hide" style="display: none">
                                    <div class="col-xs-2">
                                        <select class="form-control" id="select-sku-1"  size="1">
                                            <option value="全部">全部</option>
                                        </select>
                                    </div>
                                    <div class="col-xs-2">
                                        <select class="form-control" id="select-sku-2" size="1">
                                            <option value="全部">全部</option>
                                        </select>
                                    </div>

                                    <div class="col-xs-3">
                                        <div class="input-group">
                                            <span class="input-group-addon">库存</span>
                                            <input type="text" class="form-control" id="input_kc"/>
                                        </div>
                                    </div>
                                    <div class="col-xs-3">
                                        <div class="input-group">
                                            <span class="input-group-addon">¥</span>
                                            <input type="text" class="form-control" id="input_fnj"/>
                                        </div>
                                    </div>
                                </div>
                                <table class="table table-bordered">
                                    <thead id="gg-thead">

                                    </thead>
                                    <tbody id="gg-tbody">

                                    </tbody>
                                </table>

                                <table class="table table-bordered div_hide" style="display: none" id="gg_table">
                                    <thead>
                                    <tr>
                                        <th>总库存</th>
                                        <th>烽鸟价（元）</th>
                                        <th>积分赠送</th>
                                        <th>代金券赠送</th>
                                        <th>需要金券</th>
                                        <th>商品货号</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr>
                                        <td id="td_kc"></td>
                                        <td id="td_fnj"></td>
                                        <td id="td_jfzs"></td>
                                        <td id="td_jqzs"></td>
                                        <td id="td_xyjq"></td>
                                        <td>
                                            <input class="pdd-form-input" id="hide_sphh" type="text" value="">
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>

                                <!--										没有填规格，默认显示的-->
                                <table class="table table-bordered div_show">
                                    <thead>
                                    <tr>
                                        <th><span class="text-red">*</span>库存</th>
                                        <th><span class="text-red">*</span>烽鸟价（元）</th>
                                        <th><span class="text-red">*</span>积分赠送</th>
                                        <th><span class="text-red">*</span>代金卷赠送</th>
                                        <th><span class="text-red">*</span>需要金券</th>
                                        <th><span class="text-red">*</span>商品货号</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr>
                                        <td>
                                            <input class="pdd-form-input" id="show_kc" type="text" value="">
                                        </td>
                                        <td>
                                            <input class="pdd-form-input" id="show_fnj" type="text" value="">
                                        </td>
                                        <td>
                                            <input class="pdd-form-input" id="show_jfzs" type="text" value="">
                                        </td>
                                        <td>
                                            <input class="pdd-form-input" id="show_jqzs" type="text" value="">
                                        </td>
                                        <td>
                                            <input class="pdd-form-input" id="show_xyjq" type="text" value="">
                                        </td>
                                        <td>
                                            <input class="pdd-form-input" id="show_sphh" type="text" value="">
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                        <!-- 市场价 -->
                        <div class="form-group">
                            <label class="col-xs-3 control-label font-0" for="marketPrice">市场价</label>
                            <div class="col-xs-4">
                                <input class="form-control" type="text" id="marketPrice" placeholder="请输入您的商品的市场价">
                            </div>
                        </div>

                        <!-- 结算比例 -->
                        <div class="form-group">
                            <label class="col-xs-3 control-label font-0" for="settleCurrency">结算比例</label>
                            <div class="col-xs-4">
                                <input class="form-control" type="text" id="settleCurrency" placeholder="请输入您的商品的结算比例">
                                <div class="help-block">根据销售价与市场价比例自动生成，不需要编辑。</div>
                            </div>
                            <div class="col-xs-4 line-h40">% <span class="text-red">成为联盟商家/联盟企业可修改比例</span></div>
                        </div>
                        <!-- 赠与比例 -->
                        <div class="form-group">
                            <label class="col-xs-3 control-label font-0" for="favourCurrentcy">赠与比例</label>
                            <div class="col-xs-4">
                                <input class="form-control" type="text" id="favourCurrentcy" placeholder="请输入您的商品的赠与比例">
                                <div class="help-block">帮助商家继续回流客户，根据结算比例自动生成，不需要编辑，赠与消费者消费金额100%购物积分，同时商家可获得消费金额16%购物积分，可兑换成16%的库存广告积分</div>
                            </div>
                            <div class="col-xs-4 line-h40"> % <span class="text-red">成为联盟商家/联盟企业可修改比例</span></div>
                        </div>
                        <!-- 商品图片 -->
                        <div class="form-group">
                            <label class="col-xs-3 control-label font-0">商品图片</label>
                            <div class="col-xs-8">
                                <div class="help-block">
                                    商品主图大小不能超过3MB; 700*700 以上图片。支持jpg、jpeg、gif、png格式上传或从图片空间中选择
                                </div>
                                <div class="form-controls">
                                    <div class="upload-content">
                                        <div class="content-img">
                                            <ul class="content-img-list"></ul>
                                            <div class="file">
                                                <i class="gcl gcladd"></i>
                                                <input type="file" name="file" accept="image/*" id="upload" multiple>
                                            </div>
                                        </div>
                                        <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog"
                                             aria-labelledby="myLargeModalLabel">
                                            <div class="modal-dialog modal-lg" role="document">
                                                <div class="img-up-content">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <!-- 主体视频 -->
                        <div class="form-group">
                            <label class="col-xs-3 control-label font-0">主图视频比例</label>
                            <div class="col-xs-8">
                                <div class="help-block">
                                    <label class="lyear-radio radio-inline radio-primary">
                                        <input type="radio" name="videoType" value="0"><span>1:1或16:9</span>
                                    </label>
                                    <label class="lyear-radio radio-inline radio-primary">
                                        <input type="radio" name="videoType" value="1"><span>3：4</span>
                                    </label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-3 control-label font-0">主图视频</label>
                            <div class="col-xs-8">
                                <ul class="col-xs-4 list-inline clearfix lyear-uploads-pic">
                                    <li>
                                        <!--												<div>-->
                                        <input type="hidden" id="videoInp">
                                        <!--													<form id="videoFrom" action="/remote/upload/video" method="post"-->
                                        <!--														  enctype="multipart/form-data">-->
                                        <div class="form-group col-md-6">
														<span class="btn btn-info video-button">
															  <i class="mdi mdi-plus"></i>
															  <span id="videoValue">添加视频</span>
														   </span>
                                            <input type="file" accept="video/*" name="file" id="videoFile"
                                                   style="display: none">
                                        </div>
                                        <!--													</form>-->
                                        <div>
                                            <video id="video" style="width:200px;height: 100px;display: none" src=""  controls="controls"></video>
                                        </div>
                                        <!--												</div>-->
                                    </li>
                                </ul>
                                <ul class="col-xs-8 text-gray">
                                    <ol>
                                        1.尺寸：此次可使用1:1或16:9比例视频
                                    </ol>
                                    <ol>
                                        2.时长：15秒-60秒，建议控制在30秒内，节奏明快有助成交
                                    </ol>
                                    <ol>
                                        3.内容：突出表现1-2个商品核心卖点，画质清晰，真人演示等效果更好
                                    </ol>
                                </ul>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-xs-3 control-label font-0">商品描述</label>
                            <div class="col-xs-8">
                                <textarea id="editor" name="details"></textarea>
                            </div>
                        </div>

                        <h5 class="text-one">物流信息</h5>
                        <div class="form-group">
                            <label class="col-xs-3 control-label font-0">提取方式</label>
                            <div class="col-xs-8">
                                <div class="help-block u-f-ac">
                                    <label class="lyear-checkbox checkbox-primary text-none">
                                        <input type="checkbox" checked=""><span class="m-l-10">使用物流配送</span>
                                    </label>
                                    <span class="m-l-15">为了提升消费者购物体验，烽鸟易购要求全网商品设置运费模板</span>
                                </div>
                                <div class="row bg-fb u-f-ac p-10">
                                    <div class="col-xs-2 col-md-3">
                                        运费模板
                                    </div>
                                    <div class="col-xs-3 col-md-6">
                                        <select class="form-control" id="example-select" name="example-select" size="1">
                                            <option value="0">规格1</option>
                                            <option value="1">尺寸</option>
                                            <option value="2">型号</option>
                                            <option value="3">款式</option>
                                        </select>
                                    </div>
                                    <div class="col-xs-4 col-md-3 u-f-ac">
                                        <button class="btn btn-danger m-r-10" style="float: right;" type="button">新建运费模板</button>
                                        <button class="btn btn-danger" style="float: right;" type="button">刷新模板数据</button>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <h5 class="text-one">商店分类</h5>
                        <div class="form-group" id="b_show_div">
                            <label class="col-xs-3 control-label font-0"  for="b_type"></label>
                            <div class="col-xs-9">
                                <select class="form-control" id="b_type" name="b_type">
                                </select>
                            </div>
                        </div>

                        <h5 class="text-one">商品排序</h5>
                        <div class="form-group">
                            <label class="col-xs-3 control-label font-0"  for="sort"></label>
                            <div class="col-xs-9">
                                <input id="sort" name="sort" type="text">
                            </div>
                        </div>

                        <h5 class="text-one">售后服务</h5>
                        <div class="form-group">
                            <label class="col-xs-3 control-label font-0" for="goods_name"></label>
                            <div class="col-xs-9">
                                <div class="help-block u-f-ac">
                                    <label class="lyear-checkbox checkbox-primary text-none">
                                        <input type="checkbox"><span class="m-l-10">提供发票</span>
                                    </label>
                                    <label class="lyear-checkbox checkbox-primary text-none">
                                        <input type="checkbox"><span class="m-l-10">立即上架</span>
                                    </label>
                                    <label class="lyear-checkbox checkbox-primary text-none">
                                        <input type="checkbox"><span class="m-l-10">放入仓库</span>
                                    </label>
                                </div>
                            </div>
                        </div>

                        <h5 class="text-one">是否推荐</h5>
                        <div class="form-group">
                            <label class="col-xs-3 control-label font-0" for="goods_name"></label>
                            <div class="col-xs-9">
                                <div class="help-block u-f-ac">
                                    <label class="lyear-checkbox checkbox-primary text-none">
                                        <input type="checkbox" id="isRecommend"><span class="m-l-10">是</span>
                                    </label>
                                </div>
                            </div>
                        </div>

                        <div class="u-f-ajc p-15">
                            <button class="btn btn-danger" id="sub_btn" style="float: right;" onclick="produtcSub(1)" type="button">确认修改</button>
                        </div>
                        <div class="u-f-ajc p-15">
                            <button class="btn btn-danger" id="sub_check_btn" style="float: right;" onclick="produtcSub(2)" type="button">修改并直接通过</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!--                    -->
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/sort.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/bootstrap-table/bootstrap-table.js"></script>
<script type="text/javascript" src="js/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
<script type="text/javascript" src="js/zero2one/zero2one.version.js"></script>
<script type="text/javascript" src="js/zero2one/zero2one.core.js"></script>
<script type="text/javascript" src="js/main.min.js"></script>
<script type="text/javascript" src="js/dropzone/min/dropzone.min.js"></script>
<script type="text/javascript" src="js/zero2one/zero2one.drop.js"></script>
<!-- jquery-form表单提交插件 -->
<script type="text/javascript" src="js/jquery-form/jquery.form.js"></script>
<!-- bootstrap弹出框插件 -->
<script type="text/javascript" src="js/jquery.bootstrap.min.js"></script>
<!--连续5个上传图片-->
<script src="js/goodUploadImg/uploadImg.js"></script>
<!-- edu富文本插件 -->
<script type="text/javascript" charset="utf-8" src="js/plugin/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="js/plugin/ueditor/ueditor.all.min.js"> </script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="js/plugin/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" charset="utf-8" src="js/zero2oneMath.js"></script>

<script type="text/javascript">

    //全局商品类名
    var globalBussId;
    var globalBussName;
    var globalTypeName;
    var globalTypeIds;
    var globalList;
    var globalSkuOneList=[];
    var globalSkuTwoList=[];
    //判断输入框的值是否有改变，，改变了才添加到数组
    var temp;

    var ue = UE.getEditor('editor');

    //复写UEDITOR的getActionUrl 方法,定义自己的Action
    //上传图片
    UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
    UE.Editor.prototype.getActionUrl = function(action) {
        if (action == 'uploadimage' ) {
            return '/ueditorUploadFile';
        } else {
            return this._bkGetActionUrl.call(this, action);
        }
    };
    //获取url中的参数
    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r != null) return unescape(r[2]); return null; //返回参数值
    }
    $(function () {
        var productId = getUrlParam("id");
        $.post("/remote/tcProduct/selectTcProduct",{id:productId},function (res) {
            if (res.success){
                globalBussId= res.data.pro.businessId;
                globalBussName= res.data.pro.businessName;
                globalTypeName= res.data.pro.productTypeName;
                globalTypeIds= res.data.pro.productTypeIds;
                globalList= res.data.list;
                globalSkuOneList= JSON.parse(res.data.pro.skuOne);
                globalSkuTwoList= JSON.parse(res.data.pro.skuTwo);
                showProduct(res.data.pro,res.data.list);
            }
        })
    });

    //规格表里面的kc input失去焦点函数
    function kc_blur() {
        total()
    }
    //规格表烽鸟价 input失去焦点事件
    function fn_blur() {
        if ($(this).hasClass("fnj")){
            min(1)
        } else if ($(this).hasClass("jfzs")){
            min(2)
        } else if ($(this).hasClass("jqzs")) {
            min(3)
        }else if ($(this).hasClass("xyjq")) {
            min(4)
        }
    }

    // 操作方法 - 查看
    function showProduct(row,list) {
        //排序
        $("#sort").val(row.sort);
        if (row.isRecommend==1){
            $("#isRecommend").prop("checked","checked");
        }
        $("#productId").text(row.productId);
        $("#productTypeName").val(row.productTypeName);
        $("#productName").val(row.productName);
        //查询该店铺的分类
            $.post("/remote/BusinCates/businessTcCategoryAll",{id:row.businessId},function (res) {
                if (res.success){
                    var tempArr = res.data;
                    var str='<option value="0">请选择商店分类</option>';
                    $.each(tempArr,function (index,item) {
                        if (row.bussTypeId==item.id){
                            str+='<option value="'+item.id+'" selected>'+item.name+'</option>'
                        } else {
                            str+='<option value="'+item.id+'">'+item.name+'</option>'
                        }
                    });
                    $("#b_type").append(str);
                }
            });
        $(".select-1").css("display","none");
        $(".select-2").css("display","none");
        if (row.skuOneName) {
            $(".select-1").css("display","block");
            $("#select-1").append('<option>' + row.skuOneName + '</option>');
            var skuOneArr = [];
            skuOneArr = JSON.parse(row.skuOne);
            var str = '';
            var skuStr='';
            for (var i = 0; i < skuOneArr.length; i++) {
                str += '<div class="col-xs-4 m-tb">\n' +
                    '<div class="input-group">\n' +
                    '<input type="text" class="form-control i-gg i-gg-1" flag="1" value="' + skuOneArr[i] + '"/>\n' +
                    '</div>\n' +
                    '</div>';
                skuStr += '<option value='+skuOneArr[i]+'>' + skuOneArr[i] + '</option>';
            }
            $('.div-g-1').append(str);
            $('#select-sku-1').append(skuStr)
        }
        if (row.skuTwoName) {
            $(".select-2").css("display","block");
            $("#select-2").append('<option>' + row.skuTwoName + '</option>');
            var skuTwoArr = [];
            skuTwoArr = JSON.parse(row.skuTwo);
            var str = '';
            var skuStr='';
            for (var i = 0; i < skuTwoArr.length; i++) {
                str += '<div class="col-xs-4 m-tb">\n' +
                    '<div class="input-group">\n' +
                    '<input type="text" class="form-control i-gg i-gg-2" flag="2" value="' + skuTwoArr[i] + '"/>\n' +
                    '</div>\n' +
                    '</div>';
                skuStr += '<option value='+skuTwoArr[i]+'>' + skuTwoArr[i] + '</option>';
            }
            $('.div-g-2').append(str);
            $('#select-sku-2').append(skuStr)
        }
        $(".i-gg").unbind('blur').on("blur", attrBlur);
        $(".i-gg").unbind('focus').on("focus", attrFocus);
        //查找有没有skulist
        if (list.length === 1 && row.skuOneName == null) {
            //代表没有规格
            $("#show_kc").val(row.productStock);
            $("#show_fnj").val(row.fnPrice);
            $("#show_jfzs").val(row.giveJf);
            $("#show_jqzs").val(row.giveVoucher);
            $("#show_xyjq").val(row.needJq);
            $("#show_sphh").val(row.productCode);
            $('.div_show').css("display", "block");//显示div
            $('.div_hide').css("display", "none");//展示div
        } else {
            $('.div_show').css("display", "none");//不显示div
            $('.div_hide').css("display", "block");//展示div
            //有规格
            if (row.skuTwoName != null) {
                var str = '<tr>\n' +
                    '<th>' + row.skuOneName + '</th>\n' +
                    '<th>' + row.skuTwoName + '</th>\n' +
                    '<th><span class="text-red">*</span>库存</th>\n' +
                    '<th><span class="text-red" >*</span>烽鸟价（元）</th>\n' +
                    '<th><span class="text-red">*</span>积分赠送</th>\n' +
                    '<th><span class="text-red">*</span>代金卷赠送</th>\n' +
                    '<th><span class="text-red">*</span>需要金券</th>\n' +
                    '<th><span class="text-red">*</span>预览图</th>\n' +
                    '</tr>';
                $("#gg-thead").append(str);
                str = '';
                //遍历数组拿出数组
                for (var i = 0; i < list.length; i++) {
                    str += '<tr id="'+list[i].skuId+'" class="tr-g1-'+list[i].skuOne+' tr-g2-'+list[i].skuTwo+'">\n' +
                        '<td>' + list[i].skuOne + '</td>\n' +
                        '<td>' + list[i].skuTwo + '</td>\n' +
                        '<td>\n' +
                        '<input class="pdd-form-input kc" type="text" value="' + list[i].productStock + '">\n' +
                        '</td>\n' +
                        '<td>\n' +
                        '<input class="pdd-form-input fnj" type="text" value="' + list[i].fnPrice + '">\n' +
                        '</td>\n' +
                        '<td>\n' +
                        '<input class="pdd-form-input jfzs" readonly="readonly" type="text" value="' + list[i].giveJf + '">\n' +
                        '</td>\n' +
                        '<td>\n' +
                        '<input class="pdd-form-input jqzs" type="text" value="' + list[i].giveVoucher + '">\n' +
                        '</td>\n' +
                        '<td>\n' +
                        '<input class="pdd-form-input xyjq" type="text" value="' + list[i].needJq + '">\n' +
                        '</td>\n' +
                        '<td>\n' +
                        '<input type="hidden" name="logo" id="up-' + list[i].skuId + '">\n' +
                        '<div id="dropzone' + list[i].skuId + '"  class="dropzone"></div>\n' +
                        '</td>\n' +
                        '</td>\n' +
                        '</tr>'

                }
                $("#gg-tbody").append(str);
            } else {
                var str = '<tr>\n' +
                    '<th id="th-gg">' + row.skuOneName + '</th>\n' +
                    '<th><span class="text-red">*</span>库存</th>\n' +
                    '<th><span class="text-red" >*</span>烽鸟价（元）</th>\n' +
                    '<th><span class="text-red">*</span>积分赠送</th>\n' +
                    '<th><span class="text-red">*</span>代金卷赠送</th>\n' +
                    '<th><span class="text-red">*</span>需要金券</th>\n' +
                    '<th><span class="text-red">*</span>预览图</th>\n' +
                    '</tr>';
                $("#gg-thead").append(str);
                str = '';
                //遍历数组拿出数组
                for (var i = 0; i < list.length; i++) {
                    str += '<tr id="'+list[i].skuId+'" class="tr-g1-'+list[i].skuOne+'">\n' +
                        '<td>' + list[i].skuOne + '</td>\n' +
                        '<td>\n' +
                        '<input class="pdd-form-input kc" type="text" value="' + list[i].productStock + '">\n' +
                        '</td>\n' +
                        '<td>\n' +
                        '<input class="pdd-form-input fnj" type="text" value="' + list[i].fnPrice + '">\n' +
                        '</td>\n' +
                        '<td>\n' +
                        '<input class="pdd-form-input jfzs" readonly="readonly"  type="text" value="' + list[i].giveJf + '">\n' +
                        '</td>\n' +
                        '<td>\n' +
                        '<input class="pdd-form-input jqzs" type="text" value="' + list[i].giveVoucher + '">\n' +
                        '</td>\n' +
                        '<td>\n' +
                        '<input class="pdd-form-input xyjq" type="text" value="' + list[i].needJq + '">\n' +
                        '</td>\n' +
                        '<td>\n' +
                        '<input type="hidden" name="logo" id="up-' + list[i].skuId + '">\n' +
                        '<div id="dropzone' + list[i].skuId + '"  class="dropzone"></div>\n' +
                        '</td>\n' +
                        '</td>\n' +
                        '</tr>'

                }
                $("#gg-tbody").append(str);
            }
            //设置总库存那一行
            $("#td_kc").text(row.productStock);
            $("#td_fnj").text(row.productPrice);
            $("#td_jfzs").text(row.giveJf);
            $("#td_jqzs").text(row.giveVoucher);
            $("#td_xyjq").text(row.needJq);
            $("#hide_sphh").val(row.productCode);
            //上传图片
            for (var j = 0; j < list.length; j++) {
                zero2one.drop1("dropzone"+list[j].skuId,"up-"+list[j].skuId,"+");
                //填充表单数据
                var dropz = Dropzone.forElement('#dropzone'+list[j].skuId);//获取Dropzone元素节点
                //创建模拟文件
                var mockFile = {
                    name: list[j].picture , //显示的文件名
                    accepted:true
                };
                dropz.emit("addedfile", mockFile);
                //图片地址
                var imageUrl =list[j].picture;
                //生成缩略图
                dropz.emit("thumbnail", mockFile,imageUrl);
                //完成（如果没有，缩略图上会有一根进度条一直存在）
                dropz.emit("complete", mockFile);

                $("#up-"+list[j].skuId).val(list[j].picture)
            }
        }
        $("#marketPrice").val(row.marketPrice);
        $("#settleCurrency").val(row.settleCurrency);
        $("#favourCurrentcy").val(row.favourCurrentcy);
        if (row.subGraphList != null) {
            setImgSrc(JSON.parse(row.subGraphList), JSON.parse(row.subGraphList).length);
        } else {
            $('.content-img .file').hide();
        }
        if (row.videoSrc != null&&row.videoSrc !=='') {
            $("#videoInp").val(row.videoSrc);
            $('#video').css("display", "block");//不展示div
            $('#video').attr("src", row.videoSrc);
        }
        ue.ready(function() {
            ue.setContent(row.productDesc,true);
        });
        $(".kc").unbind("blur").on("blur", kc_blur);
        $(".fnj").unbind("blur").on("blur", fn_blur);
        $(".jqzs").unbind("blur").on("blur", fn_blur);
        $(".xyjq").unbind("blur").on("blur", fn_blur);
    }

    function min(flag) {
        var arr;
        var that;
        if (flag===1){
            arr = $(".fnj");
            that=$("#td_fnj")
        } else if (flag===2){
            arr = $(".jfzs");
            that=$("#td_jfzs")
        }else if (flag===3){
            arr = $(".jqzs");
            that=$("#td_jqzs")
        }else if (flag===4){
            arr = $(".xyjq");
            that=$("#td_xyjq")
        }
        var min=arr[0].value-0;
        $.each(arr,function (index,item) {
            if ((item.value-0)<min) min=(item.value-0)
        });
        that.text(min);

    }

    function total() {
        var kcArr = $(".kc");
        var totalKc=0;
        $.each(kcArr,function (index,item) {
            totalKc+=(item.value-0)
        });
        $("#td_kc").text(totalKc);
    }

    //属性框获取焦点函数
    function attrFocus(){
        temp=this.value.replace(/\s+/g,"");
    }
    //绑定属性框获取焦点函数
    $(".i-gg").on("focus", attrFocus);

    //属性框失去焦点函数
    function attrBlur() {
        var value = this.value.replace(/\s+/g,"");
        if (temp === value) {
            if (value == null || value === "" || value === '') {
                $(this).parent().parent().remove();
            }
            return
        }
        var tempArr;
        var flag=$(this).attr("flag");
        var select;
        if (flag==="1"){
            tempArr=globalSkuOneList;
            select=$("#select-sku-1")
        } else {
            tempArr=globalSkuTwoList;
            select=$("#select-sku-2")

        }
        //两个值不相等，有改变,,判断数组里面有没
        if (temp == null || temp === '' || temp === "") {
            if (tempArr.indexOf(value) === -1){
                tempArr.push(value);
                select.append('<option value="'+value+'">'+value+'</option>');
                //添加一行
                var str='';
                if (globalSkuTwoList==null||globalSkuTwoList.size===0){
                    str = '<tr class="tr-g' +flag+'-'+value + '">\n' +
                        '<td>' + value + '</td>\n' +
                        '<td>\n' +
                        '<input class="pdd-form-input kc" type="text">\n' +
                        '</td>\n' +
                        '<td>\n' +
                        '<input class="pdd-form-input fnj" type="text">\n' +
                        '</td>\n' +
                        '<td>\n' +
                        '<input class="pdd-form-input jfzs" type="text">\n' +
                        '</td>\n' +
                        '<td>\n' +
                        '<input class="pdd-form-input jqzs" type="text">\n' +
                        '</td>\n' +
                        '<td>\n' +
                        '<input class="pdd-form-input xyjq" type="text">\n' +
                        '</td>\n' +
                        '<td>\n' +
                        '<input type="hidden" name="logo" id="up-'+flag+'-'+ value + '">\n' +
                        '<div id="dropzone' +flag+'-'+ value + '"  class="dropzone"></div>\n' +
                        '</td>\n' +
                        '</td>\n' +
                        '</tr>';
                    $("#gg-tbody").append(str);
                    zero2one.drop1('dropzone1-'+value,'up-1-'+value,"+");
                } else {
                    if (flag==="1"){
                        $.each(globalSkuTwoList,function (index, item) {
                            str= '<tr class="tr-g1-'+value + ' tr-g2-'+item+'">\n' +
                                '<td>' + value + '</td>\n' +
                                '<td>' + item + '</td>\n' +
                                '<td>\n' +
                                '<input class="pdd-form-input kc" type="text">\n' +
                                '</td>\n' +
                                '<td>\n' +
                                '<input class="pdd-form-input fnj" type="text">\n' +
                                '</td>\n' +
                                '<td>\n' +
                                '<input class="pdd-form-input jfzs" type="text" readonly="readonly">\n' +
                                '</td>\n' +
                                '<td>\n' +
                                '<input class="pdd-form-input jqzs" type="text">\n' +
                                '</td>\n' +
                                '<td>\n' +
                                '<input class="pdd-form-input xyjq" type="text">\n' +
                                '</td>\n' +
                                '<td>\n' +
                                '<input type="hidden" name="logo" id="up-1-'+value+'-2-'+item+'">\n' +
                                '<div id="dropzone-1-'+ value + '-2-'+item+'"  class="dropzone"></div>\n' +
                                '</td>\n' +
                                '</td>\n' +
                                '</tr>';
                            $("#gg-tbody").append(str);
                            zero2one.drop1('dropzone-1-'+ value + '-2-'+item,'up-1-'+value+'-2-'+item,"+");
                        });
                    } else {
                        $.each(globalSkuOneList,function (index, item) {
                            str= '<tr class="tr-g1-'+item + ' tr-g2-'+value+'">\n' +
                                '<td>' + item + '</td>\n' +
                                '<td>' + value + '</td>\n' +
                                '<td>\n' +
                                '<input class="pdd-form-input kc" type="text">\n' +
                                '</td>\n' +
                                '<td>\n' +
                                '<input class="pdd-form-input fnj" type="text">\n' +
                                '</td>\n' +
                                '<td>\n' +
                                '<input class="pdd-form-input jfzs" type="text" readonly="readonly">\n' +
                                '</td>\n' +
                                '<td>\n' +
                                '<input class="pdd-form-input jqzs" type="text">\n' +
                                '</td>\n' +
                                '<td>\n' +
                                '<input class="pdd-form-input xyjq" type="text">\n' +
                                '</td>\n' +
                                '<td>\n' +
                                '<input type="hidden" name="logo" id="up-1-'+item+'-2-'+value+'">\n' +
                                '<div id="dropzone-1-'+ item + '-2-'+value+'"  class="dropzone"></div>\n' +
                                '</td>\n' +
                                '</td>\n' +
                                '</tr>';
                            $("#gg-tbody").append(str);
                            zero2one.drop1('dropzone-1-'+ item + '-2-'+value,'up-1-'+item+'-2-'+value,"+");
                        });
                    }
                }
                // $("#gg-tbody").append(str);
                $(".kc").unbind("blur").on("blur", kc_blur);
                $(".fnj").unbind("blur").on("blur", fn_blur);
                $(".jqzs").unbind("blur").on("blur", fn_blur);
                $(".xyjq").unbind("blur").on("blur", fn_blur);
            }else {
                $.messager.alert("验证提示", "不能填写相同的属性值");
                $(this).parent().parent().remove();
            }
        } else {
            if (value == null || value === "" || value === '') {
                if(tempArr.length===1){
                    $(this).val(temp);
                    return  $.messager.alert("验证提示", "至少保留一个规格属性值");
                }
                tempArr.splice(tempArr.indexOf(temp),1);
                select.find('option[value="'+temp+'"]').remove();
                $(this).parent().parent().remove();
                $("tr.tr-g"+flag+"-"+temp).remove();
                min(1);
                min(2);
                min(3);
                min(4);
                total()
            } else {
                if (tempArr.indexOf(value) === -1){
                    tempArr.splice(tempArr.indexOf(temp),1,value);
                    select.find('option[value="'+temp+'"]').attr("value",value).text(value);
                    var g1Arr= document.getElementsByClassName("tr-g"+flag+"-"+temp);
                    // var g1Arr = $("tr.tr-g"+flag+"-"+temp);
                    $.each(g1Arr,function (index, item) {
                        $(item).addClass("tr-g"+flag+"-"+value);
                        $(item).removeClass("tr-g"+flag+"-"+temp);
                        if (flag==='1'){
                            $(item.children[0]).text(value)
                        }else {
                            $(item.children[1]).text(value)
                        }
                        /*                            if (globalSkuTwoList==null||globalSkuTwoList.size===0){
                                                        $(item.children[0]).text(value)
                                                    }else {
                                                        $(item.children[1]).text(value)
                                                    }*/
                    });
                }else {
                    $.messager.alert("验证提示", "不能填写相同的属性值");
                    tempArr.splice(tempArr.indexOf(temp),1);
                    $(this).parent().parent().remove();
                    $("tr-g"+flag+"-"+temp).remove();
                }

            }
        }
    }
    //绑定属性框失去焦点函数
    $(".i-gg").on("blur", attrBlur);

    //添加属性，，添加输入框
    $(".attr-b").click(function () {
        if($(this).attr('type')==='1'){
            var str='<div class="col-xs-4 m-tb">\n' +
                '<div class="input-group">\n' +
                '<input type="text" class="form-control i-gg i-gg-1" flag="1"/>\n' +
                '</div>\n' +
                '</div>';
            $('.div-g-1').append(str)
        }else {
            var str='<div class="col-xs-4 m-tb">\n' +
                '<div class="input-group">\n' +
                '<input type="text" class="form-control i-gg i-gg-2" flag="2"/>\n' +
                '</div>\n' +
                '</div>';
            $('.div-g-2').append(str)
        }
        //新添加属性，先解除绑定，重新绑定事件
        $(".i-gg").unbind('blur').on("blur", attrBlur);
        $(".i-gg").unbind('focus').on("focus", attrFocus);
    });


    //设置按钮点击事件
    function setting() {
        var kc = $("#input_kc").val().trim();
        if (kc==null||kc===''){
            return $.messager.alert("验证提示", "库存不能为空");
        }
        var fnj = $("#input_fnj").val().trim();
        if (fnj==null||fnj===''){
            return $.messager.alert("验证提示", "价格不能为空");
        }
        var sku_one = $("#select-sku-1").find("option:selected").val();
        var sku_two = $("#select-sku-2").find("option:selected").val();
        if (sku_one==='全部'){
            if (sku_two==='全部'){
                $("input.kc").val(kc);
                $("input.fnj").val(fnj)
            } else {
                $("tr.tr-g2-"+sku_two+" input.kc").val(kc);
                $("tr.tr-g2-"+sku_two+" input.fnj").val(fnj)
            }
        }else {
            if (sku_two==='全部'){
                $("tr.tr-g1-"+sku_one+" input.kc").val(kc);
                $("tr.tr-g1-"+sku_one+" input.fnj").val(fnj);
            } else {
                $("tr.tr-g1-"+sku_one+".tr-g2-"+sku_two+" input.kc").val(kc);
                $("tr.tr-g1-"+sku_one+".tr-g2-"+sku_two+" input.fnj").val(fnj);

            }
        }
        //设置最下面的值
        total();
        min(1);
    }
    $("#set_bun").on("click", setting);

    //切换类目按钮
    $("#changeProType").click(function () {
        if ($("#goodTypeDiv").css("display")==="block"){
            $("#goodTypeDiv").css("display","none");
            $("#changeProType").text("切换类目");
            $("#productTypeName").val(globalTypeName);
        }else {
            $("#goodTypeDiv").css("display","block");
            $("#changeProType").text("取消")
        }
    });

    $(".video-button").click(function () {
        $("#videoFile").click()
    });

    $("#videoFile").bind('input propertychange', function() {
        var file = this.files[0];
        var value = $("#videoFile").val();
        if (value!=''){
            $("#videoValue").html(value);
            var formData = new FormData();
            formData.append('file', file);
            $.ajax({
                url:'/remote/upload/video',
                type:'POST',
                data:formData,
                processData:false,
                contentType:false,
                async: true,
                success:function(res){
                    if (res.code===200){
                        $("#videoInp").val(res.data);
                        $("#video").attr("src",res.data);
                        $('#video').css("display","block");//不展示div
                    }
                }
            });
        }
    });

    // $("#sub_btn").click(function () {
    function produtcSub(subType){
        /* if(flag==false){
             return $.messager.alert("验证提示", "分类要选择四级");
         }*/
        //验证
        //id
        var productId=$("#productId").text().trim();
        //商品标题
        var productName=$("#productName").val().trim();
        if (productName.length<3){
            return $.messager.alert("验证提示", "商品标题至少3个字符");
        }
        //商品图片,,一个数组
        var imgSrcArr = getImgSrc();
        if (imgSrcArr.length===0){
            return $.messager.alert("验证提示", "商品图片至少上传一张");
        }
        //商品规格
        var list=[];
        if (globalSkuOneList==null||globalSkuOneList.length===0){
            if (globalSkuTwoList==null||globalSkuTwoList.length===0){
                //库存
                productStock=$("#show_kc").val().trim();
                //烽鸟价
                productPrice=$("#show_fnj").val().trim();
                //商品货号
                productCode=$("#show_sphh").val().trim();
                //积分赠送
                jfzs = $("#show_jfzs").val().trim();
                //代金券赠送
                jqzs=$("#show_jqzs").val().trim();
                //需要金券
                xyjq=$("#show_xyjq").val().trim();
                var tempSku={skuId:globalList[0].skuId,giveJf:jfzs,giveVoucher:jqzs,needJq:xyjq,fnPrice:productPrice,productStock:productStock,picture:imgSrcArr[0]};
                list.push(tempSku);
                skuOneName=null;
                //规格二名称
                skuTwoName=null;
                //规格一的值
                skuOneValue=null;
                //规格二的值
                skuTwoValue=null;
            } else {
                ggForm(list,2);
            }
        } else {
            if (globalSkuTwoList==null||globalSkuTwoList.length===0){
                ggForm(list,1)
            } else {
                ggForm(list,3)
            }
        }
        //市场价
        var marketPrice=$("#marketPrice").val().trim();
        //结算比例
        var settleCurrency=$("#settleCurrency").val().trim();
        //赠与比例
        var favourCurrentcy=$("#favourCurrentcy").val().trim();
        //分类名称
        var productTypeName=$("#productTypeName").val().trim();

        //分类级别
        var selectedSort=globalTypeIds;
        if (productTypeName!==globalTypeName) {
            selectedSort=$("#selectedSort").val();
        }
        //视频比例
        var videoType = $(':radio[name="videoType"]:checked').val();
        //视频
        var videoSrc=$("#videoInp").val();
        //文本编辑器内容
        var productDesc=UE.getEditor('editor').getContent();
        var businessId=globalBussId;
        var businessName=globalBussName;
        var bussTypeId=$("#b_type").val();
        if (bussTypeId==null||bussTypeId==='0'){
            return $.messager.alert("验证提示", "请选择店铺分类");
        }
        //排序
        var sort=$("#sort").val().trim();
        var isRecommend=0;
        if($('#isRecommend').is(':checked')) {
            isRecommend=1
        }
        var vo={productId: productId,productName:productName,productStock:productStock,productPrice:productPrice,productCode:productCode,businessId:businessId,businessName:businessName,bussTypeId:bussTypeId,
            skuList:list,marketPrice:marketPrice,settleCurrency:settleCurrency,favourCurrentcy:favourCurrentcy,subGraphList:JSON.stringify(imgSrcArr),
            videoType:videoType,videoSrc:videoSrc,productDesc:productDesc,skuOneName:skuOneName,skuTwoName:skuTwoName,
            skuOne:skuOneValue,skuTwo:skuTwoValue,giveJf:jfzs,giveVoucher:jqzs,needJq:xyjq,productTypeIds:selectedSort,productTypeName:productTypeName,sort:sort,isRecommend:isRecommend};
        if (subType==1){
            $.ajax({
                url: '/remote/tcProduct/editTcProduct',
                contentType:'application/json',
                type: 'post',
                data: JSON.stringify(vo),
                dataType: 'json',
                success: function (res) {
                    if (res.success){
                        $.messager.alert("温馨提示", "操作成功,2S之后刷新");
                        setTimeout(function () {
                            window.location.reload();
                        }, 2000);
                    }else {
                        $.messager.alert("温馨提示","操作失败");
                    }
                }
            });
        } else {
            $.messager.confirm("温馨提示", "您确定要更改用户状态吗?", function () {
                $.ajax({
                    url: '/remote/product/saveAndCheck',
                    contentType:'application/json',
                    type: 'post',
                    data: JSON.stringify(vo),
                    dataType: 'json',
                    success: function (res) {
                        if (res.success){
                            $.messager.alert("温馨提示", "操作成功,2S之后刷新");
                            setTimeout(function () {
                                window.location.reload();
                            }, 2000);
                        }else {
                            $.messager.alert("温馨提示","操作失败");
                        }
                    }
                });
            })
        }
    }

    //规格表提交的公共方法
    function ggForm(list,flag) {
        var trArr = $('#gg-tbody tr');
        var tempVo={};
        //选中的规格名字
        if (flag===1||flag===2){
            skuOneName = $("#select-"+flag).find("option:selected").text();
            skuTwoName=null;
            if (flag===1){
                skuOneValue=JSON.stringify(globalSkuOneList);
            } else {
                skuOneValue=JSON.stringify(globalSkuTwoList);
            }
            skuTwoValue=null;
            $.each(trArr,function (index,item) {
                var skuId=null;
                if (item.id){
                    skuId=item.id
                }
                var gg=$(item.children[0]).text().trim();
                var kc=$(item.children[1].children[0]).val().trim();
                var fnj=$(item.children[2].children[0]).val().trim();
                var jf_zs=$(item.children[3].children[0]).val().trim();
                var jq_zs=$(item.children[4].children[0]).val().trim();
                var xy_jq=$(item.children[5].children[0]).val().trim();
                var src=$(item.children[6].children[0]).val().trim();
                tempVo={skuId:skuId,skuOneName:skuOneName,skuOne:gg,productStock:kc,fnPrice:fnj,giveJf:jf_zs,giveVoucher:jq_zs,needJq:xy_jq,picture:src};
                list.push(tempVo)
            });
        } else {
            skuOneName = $("#select-1").find("option:selected").text();
            skuTwoName = $("#select-2").find("option:selected").text();
            skuOneValue=JSON.stringify(globalSkuOneList);
            skuTwoValue=JSON.stringify(globalSkuTwoList);
            $.each(trArr,function (index,item) {
                var skuId=null;
                if (item.id){
                    skuId=item.id
                }
                var gg1=$(item.children[0]).text().trim();
                var gg2=$(item.children[1]).text().trim();
                var kc=$(item.children[2].children[0]).val().trim();
                var fnj=$(item.children[3].children[0]).val().trim();
                var jf_zs=$(item.children[4].children[0]).val().trim();
                var jq_zs=$(item.children[5].children[0]).val().trim();
                var xy_jq=$(item.children[6].children[0]).val().trim();
                var src=$(item.children[7].children[0]).val().trim();
                tempVo={skuId:skuId,skuOneName:skuOneName,skuTwoName:skuTwoName,skuOne:gg1,skuTwo:gg2,productStock:kc,fnPrice:fnj,giveJf:jf_zs,giveVoucher:jq_zs,needJq:xy_jq,picture:src};
                list.push(tempVo)
            });
        }
        //库存
        productStock=$("#td_kc").text().trim();
        //烽鸟价
        productPrice=$("#td_fnj").text().trim();
        //商品货号
        productCode=$("#hide_sphh").val().trim();
        //积分
        jfzs=$("#td_jfzs").text().trim();
        //金券
        jqzs=$("#td_jqzs").text().trim();
        //需要金券
        xyjq=$("#td_xyjq").text().trim();
    }

    //结算比例失去焦点事件
    $("#settleCurrency").blur(function () {
        var currency = $("#settleCurrency").val().trim();
        if (currency==''){
            return
        }
        if (currency<0||currency>100){
            $("#settleCurrency").val('');
            return $.messager.alert("验证提示", "请填写0-100");
        }
        var num = numSub(100,currency);
        $("#favourCurrentcy").val(num);
        if ($("#gg-tbody tr").length>0){
            var fngArr=$("#gg-tbody input.fnj");
            $.each(fngArr,function (index,item) {
                $('#gg-tbody tr:eq('+index+') input.jfzs')[0].value=Math.round(numDiv(numMulti(item.value,numDiv(num,100)),0.16));
                min(2)
            })
        }else {
            var fnj = $("#show_fnj").val().trim();
            $("#show_jfzs").val(Math.round(numDiv(numMulti(fnj,numDiv(num,100)),0.16)))
        }
    });

    //赠与比例失去焦点事件
    $("#favourCurrentcy").blur(function () {
        var currency = $("#favourCurrentcy").val().trim();
        if (currency==''){
            return
        }
        if (currency<0||currency>100){
            $("#favourCurrentcy").val('');
            return $.messager.alert("验证提示", "请填写0-100");
        }
        var num = numSub(100,currency);
        $("#settleCurrency").val(num);
        if ($("#gg-tbody tr").length>0){
            var fngArr=$("#gg-tbody input.fnj");
            $.each(fngArr,function (index,item) {
                $('#gg-tbody tr:eq('+index+') input.jfzs')[0].value=Math.round(numDiv(numMulti(item.value,numDiv(currency,100)),0.16));
                min(2)
            })
        }else {
            var fnj = $("#show_fnj").val().trim();
            $("#show_jfzs").val(Math.round(numDiv(numMulti(fnj,numDiv(currency,100)),0.16)))
        }
    })



</script>

</div>
</body>
</html>
